<?php 
session_cache_expire(999999999);
if(!isset($_SESSION)) 
	{ 
		session_start(); 
	}
	

require_once('calendar/classes/tc_calendar.php');

include "generallibraries/funcs1.php";
$mangContractType=mysql_query("SELECT * FROM contract_type;");
$query_de = mysql_query("select department.IDDepartment, department_lang.DepartmentName from department, department_lang where department.IDDepartment = department_lang.IDDepartment and department_lang.LangID='".$lang."'");
$mangkq=array();
while ($row=mysql_fetch_array($query_de)){
	$query11  = mysql_query("SELECT IDEmployee,FullName  FROM employee where State!=0 AND IDRole!=1 AND IDRole!=1 and IDDepartment='".$row[0]."'");
	$mangone=array();
	while($row1=mysql_fetch_array($query11)){
		$mangone[]=$row1;
	}
	$mangkq[$row[1]]=$mangone;
}


$todate=date("Y-m-d"); 

	$id=0;
	$type=1;
	$code="";
	$name="";
	$signer="";
	$signDay=$todate;
	$totalValue="";
	$prepaidMoney="";
	$otherMoney="";
	$statusPayment=0;
	$expectedDay="";
	$completeDay="";
	$area="";
	$placeDelivery="";
	$nameCompany="";
	$agencies="";
	$provideGovernment="";
	$method1="";
	$content1="";
	$method2="";
	$provide="";
	$nameProduct="";
	$promotions="";
	$expireWarrantyDay="";
	$agenciesCheck="";
	$methodsPayment="";
	$methodsDelivery="";
	$classification="";
	$comment="";
	//$warranty="";
	//$warrantyDays="";
	
	if(isset($_REQUEST['Update'])){
		
	$id=$_REQUEST['id'];
	$type=$_REQUEST['type'];
	$code=$_REQUEST['code'];
	$name=$_REQUEST['name'];
	$signer=$_REQUEST['signer'];
	$signDay=$_REQUEST['signDay'];
	$totalValue=str_replace(',', '', $_REQUEST['totalValue']);
	$prepaidMoney=str_replace(',', '', $_REQUEST['prepaidMoney']);
	$otherMoney=str_replace(',', '', $_REQUEST['otherMoney']);
	$statusPayment=$_REQUEST['statusPayment'];
	$expectedDay=$_REQUEST['expectedDay'];
	$completeDay=$_REQUEST['completeDay'];
	$area=$_REQUEST['area'];
	$placeDelivery=$_REQUEST['placeDelivery'];
	$nameCompany=$_REQUEST['nameCompany'];
	$agencies=$_REQUEST['agencies'];
	$provideGovernment=$_REQUEST['provideGovernment'];
	$method1=$_REQUEST['method1'];
	$content1=$_REQUEST['content1'];
	$method2=$_REQUEST['method2'];
	$provide=$_REQUEST['provide'];
	$nameProduct=$_REQUEST['nameProduct'];
	$promotions=$_REQUEST['promotions'];
	$expireWarrantyDay=$_REQUEST['expireWarrantyDay'];
	$agenciesCheck=$_REQUEST['agenciesCheck'];
	$methodsPayment=$_REQUEST['methodsPayment'];
	$methodsDelivery=$_REQUEST['methodsDelivery'];
	$classification=$_REQUEST['classification'];
	$comment=$_REQUEST['comment'];
	//$warranty=$_REQUEST['warranty'];
	//$warrantyDays=$_REQUEST['warrantyDays'];

	$id_employee=$_SESSION['IDEmployee'];
	
	if($code=="")
		//$_SESSION['error']= "Fill code";
		echo "<script>alert('$l_errorMessage');</script>";
	else if($name=="")
		//$_SESSION['error']= "Fill name";
		echo "<script>alert('$l_errorMessage');</script>";
	else if($totalValue=="" || $totalValue==0)
		//$_SESSION['error']= "Fill totalValue";
		echo "<script>alert('$l_errorMessage');</script>";
	else{
		$result=mysql_query("SELECT * FROM contract c WHERE c.id!='$id' AND c.`code`='$code'");
		if(mysql_num_rows($result)>0){
			echo "<script>alert('$l_errorMessage1');</script>";
		}else{
			$sql="UPDATE `contract` SET `type`='$type', `name`='$name', `signer`='$signer', `signDay`='$signDay', `code`='$code',
							  `totalValue`='$totalValue', `prepaidMoney`='$prepaidMoney', `otherMoney`='$otherMoney', `statusPayment`='$statusPayment', 
							  `expectedDay`='$expectedDay', `completeDay`='$completeDay', `area`='$area', `placeDelivery`='$placeDelivery', 
							  `nameCompany`='$nameCompany', `agencies`='$agencies', `provideGovernment`='$provideGovernment', `method1`='$method1', 
							  `content`='$content1', `method2`='$method2', `provide`='$provide', `nameProduct`='$nameProduct', `promotions`='$promotions', 
							  `expireWarrantyDay`='$expireWarrantyDay', `agenciesCheck`='$agenciesCheck', `methodsPayment`='$methodsPayment', 
							  `methodsDelivery`='$methodsDelivery', `classification`='$classification', `comment`='$comment' 
				WHERE (`id`='$id')";
			
			
				mysql_query($sql);
				$_SESSION['successup']=1;
			//nameCompany
					if($nameCompany!=""){
						$kq=mysql_query("SELECT * FROM contract_company c WHERE c.`name`='$nameCompany';");
						if(mysql_num_rows($kq)<=0)
							mysql_query("INSERT INTO `contract_company` (`name`) VALUES ('$nameCompany')");
					}
					//agencies
					if($agencies!=""){
						$kq=mysql_query("SELECT * FROM contract_agencies c WHERE c.`name`='$agencies';");
						if(mysql_num_rows($kq)<=0)
							mysql_query("INSERT INTO `contract_agencies` (`name`) VALUES ('$agencies')");
					}
					//method1
					if($method1!=""){
						$kq=mysql_query("SELECT * FROM contract_method1 c WHERE c.`name`='$method1';");
						if(mysql_num_rows($kq)<=0)
							mysql_query("INSERT INTO `contract_method1` (`name`) VALUES ('$method1')");
					}
					//method2
					if($method2!=""){
						$kq=mysql_query("SELECT * FROM contract_method2 c WHERE c.`name`='$method2';");
						if(mysql_num_rows($kq)<=0)
							mysql_query("INSERT INTO `contract_method2` (`name`) VALUES ('$method2')");
					}
					//content1
					if($content1!=""){
						$kq=mysql_query("SELECT * FROM contract_content c WHERE c.`name`='$content1';");
						if(mysql_num_rows($kq)<=0)
							mysql_query("INSERT INTO `contract_content` (`name`) VALUES ('$content1')");
					}
					//$nameProduct
					if($nameProduct!=""){
						$kq=mysql_query("SELECT * FROM contract_nameProduct c WHERE c.`name`='$nameProduct';");
						if(mysql_num_rows($kq)<=0)
							mysql_query("INSERT INTO `contract_nameProduct` (`name`) VALUES ('$nameProduct')");
					}
					//$promotions
					if($promotions!=""){
						$kq=mysql_query("SELECT * FROM contract_promotions c WHERE c.`name`='$promotions';");
						if(mysql_num_rows($kq)<=0)
							mysql_query("INSERT INTO `contract_promotions` (`name`) VALUES ('$promotions')");
					}
					//$agenciesCheck
					if($agenciesCheck!=""){
						$kq=mysql_query("SELECT * FROM contract_agenciesCheck c WHERE c.`name`='$agenciesCheck';");
						if(mysql_num_rows($kq)<=0)
							mysql_query("INSERT INTO `contract_agenciesCheck` (`name`) VALUES ('$agenciesCheck')");
					}
					//methodsPayment
					if($methodsPayment!=""){
						$kq=mysql_query("SELECT * FROM contract_methodsPayment c WHERE c.`name`='$methodsPayment';");
						if(mysql_num_rows($kq)<=0)
							mysql_query("INSERT INTO `contract_methodsPayment` (`name`) VALUES ('$methodsPayment')");
					}
					//$classification
					if($classification!=""){
						$kq=mysql_query("SELECT * FROM contract_classification c WHERE c.`name`='$classification';");
						if(mysql_num_rows($kq)<=0)
							mysql_query("INSERT INTO `contract_classification` (`name`) VALUES ('$classification')");
					}		
			
				header("Location: contract.php");
			}
		}
	
	}else if(isset($_REQUEST['Delete'])){
		$code=$_REQUEST['code'];
		//$sql="UPDATE `contract` SET `status`='1' WHERE (`code`='$code')";
		$sql="DELETE FROM `contract` WHERE (`code`='$code')";
		mysql_query($sql);
		$_SESSION['successdel']=1;
		header("Location: contract.php");
	}else if(isset($_REQUEST['Cancel'])){
		
		header("Location: contract.php");
	}else{
		$code=$_REQUEST['code'];
		$result = mysql_query("SELECT * FROM contract c WHERE c.`code`='$code';");
		while ($row=mysql_fetch_array($result)){
			$id=$row['id'];
			$type=$row['type'];
			$code=$row['code'];
			$name=$row['name'];
			$signer=$row['signer'];
			$_REQUEST["signer"]=$row['signer'];
			$signDay=$row['signDay'];
			$totalValue=$row['totalValue'];
			$prepaidMoney=$row['prepaidMoney'];
			$otherMoney=$row['otherMoney'];
			$statusPayment=$row['statusPayment'];
			$expectedDay=$row['expectedDay'];
			$completeDay=$row['completeDay'];
			$area=$row['area'];
			$placeDelivery=$row['placeDelivery'];
			$nameCompany=$row['nameCompany'];
			$agencies=$row['agencies'];
			$provideGovernment=$row['provideGovernment'];
			$method1=$row['method1'];
			$content1=$row['content'];
			$method2=$row['method2'];
			$provide=$row['provide'];
			$nameProduct=$row['nameProduct'];
			$promotions=$row['promotions'];
			$expireWarrantyDay=$row['expireWarrantyDay'];
			$agenciesCheck=$row['agenciesCheck'];
			$methodsPayment=$row['methodsPayment'];
			$methodsDelivery=$row['methodsDelivery'];
			$classification=$row['classification'];
			$comment=$row['comment'];
			//$warranty=$row['warranty'];
			//$warrantyDays=$row['warrantyDays'];
		}
	}
	
	
	

/*$y=date("Y")+1;
  $myCalendar = new tc_calendar("signDay", true);
  $myCalendar->setIcon("calendar/images/iconCalendar.gif");
  $d=split('-',$todate,3);
 
  $myCalendar->setDate($d[2],$d[1],$d[0]);
  $myCalendar->setPath("calendar/");
  $myCalendar->setYearInterval(2006, $y);
  $myCalendar->dateAllow('2006-01-01', $y.'-12-31');
  //$myCalendar1->setHeight(350);
  //$myCalendar1->autoSubmit(true, "form1");
  //$myCalendar1->setSpecificDate(array("2011-04-01", "2011-04-13", "2011-04-25"), 0, 'month');
  $myCalendar->setOnChange("myChanged('test')");
  //$myCalendar->rtl = true;*/
  $bien = generalFunctions::xuatds($mangkq,'signer',$l_all);

?>
<link	href="css/style.css" rel="stylesheet" type="text/css" />
<link  href="admin/css/jsDatePick_ltr.min.css" rel="stylesheet" type="text/css" media="all" />
<link rel="stylesheet" type="text/css" href="js/jquery.autocomplete.css" />
<script type="text/javascript" src="js/jquery.autocomplete.js"></script>
<script type="text/javascript" src="admin/css/jsDatePick.min.1.3.js"></script>
<script type="text/javascript" src="js/accouting.js"></script>
<script type="text/javascript" src="js/jquery.price_format.1.7.js"></script>
<script type="text/javascript" src="js/jquery.price_format.1.7.min.js"></script>
<script type="text/javascript">
window.onload = function(){
	new JsDatePick({
		useMode:2,
		target:"signDay",

		dateFormat:"%Y-%m-%d"
	});
	new JsDatePick({
		useMode:2,
		target:"expectedDay",

		dateFormat:"%Y-%m-%d"
	});
	new JsDatePick({
		useMode:2,
		target:"completeDay",

		dateFormat:"%Y-%m-%d"
	});
	new JsDatePick({
		useMode:2,
		target:"expireWarrantyDay",

		dateFormat:"%Y-%m-%d"
	});
	
};

$(document).ready(function(){
	$('#totalValue').priceFormat({
		prefix: '',
		centsLimit: 0,
		centsSeparator: '',
		thousandsSeparator: ','
	});
	$('#prepaidMoney').priceFormat({
		prefix: '',
		centsLimit: 0,
		centsSeparator: '',
		thousandsSeparator: ','
	});
	$('#otherMoney').priceFormat({
		prefix: '',
		centsLimit: 0,
		centsSeparator: '',
		thousandsSeparator: ','
	});
	Load();
	
	
});
function Load(){
	//nameCompany
	$("#nameCompany").autocomplete("operations/rpc_contract_company.php", {
		selectFirst: true	
	});
	$('#content_menu_expand1').hide();
	$(document).click(function() {
			$("#content_menu_expand1").hide();
	});
	$('#content_menu_expand1').click(function(e) {
		e.stopPropagation();
	});
	$('#menu_expand1').click(function(event) {
		if ($('#content_menu_expand1').is(":hidden")) {
			$('#content_menu_expand1').show();
			$('#content_menu_expand2').hide();
			$('#content_menu_expand3').hide();
			$('#content_menu_expand4').hide();
			$('#content_menu_expand5').hide();
			$('#content_menu_expand6').hide();
			$('#content_menu_expand7').hide();
			$('#content_menu_expand8').hide();
			$('#content_menu_expand9').hide();
			$('#content_menu_expand10').hide();
		}
		else
			$('#content_menu_expand1').hide();
		return false;
	});
	
	// agencies
	$("#agencies").autocomplete("operations/rpc_contract_agencies.php", {
		selectFirst: true
	});
	$('#content_menu_expand2').hide();
	$(document).click(function() {
			$("#content_menu_expand2").hide();
	});
	$('#content_menu_expand2').click(function(e) {
		e.stopPropagation();
	});
	$('#menu_expand2').click(function(event) {
		if ($('#content_menu_expand2').is(":hidden")) {
			$('#content_menu_expand2').show();
			$('#content_menu_expand1').hide();
			$('#content_menu_expand3').hide();
			$('#content_menu_expand4').hide();
			$('#content_menu_expand5').hide();
			$('#content_menu_expand6').hide();
			$('#content_menu_expand7').hide();
			$('#content_menu_expand8').hide();
			$('#content_menu_expand9').hide();
			$('#content_menu_expand10').hide();
		}
		else
			$('#content_menu_expand2').hide();
		return false;
	});
	//method1
	$("#method1").autocomplete("operations/rpc_contract_method1.php", {
		selectFirst: true
	});
	$('#content_menu_expand3').hide();
	$(document).click(function() {
			$("#content_menu_expand3").hide();
	});
	$('#content_menu_expand3').click(function(e) {
		e.stopPropagation();
	});
	$('#menu_expand3').click(function(event) {
		if ($('#content_menu_expand3').is(":hidden")) {
			$('#content_menu_expand3').show();
			$('#content_menu_expand2').hide();
			$('#content_menu_expand1').hide();
			$('#content_menu_expand4').hide();
			$('#content_menu_expand5').hide();
			$('#content_menu_expand6').hide();
			$('#content_menu_expand7').hide();
			$('#content_menu_expand8').hide();
			$('#content_menu_expand9').hide();
			$('#content_menu_expand10').hide();
		}
		else
			$('#content_menu_expand3').hide();
		return false;
	});

	//content1
	$("#content1").autocomplete("operations/rpc_contract_content.php", {
		selectFirst: true
		
	});
	$('#content_menu_expand4').hide();
	$(document).click(function() {
			$("#content_menu_expand4").hide();
	});
	$('#content_menu_expand4').click(function(e) {
		e.stopPropagation();
	});
	$('#menu_expand4').click(function(event) {
		if ($('#content_menu_expand4').is(":hidden")) {
			$('#content_menu_expand4').show();
			$('#content_menu_expand2').hide();
			$('#content_menu_expand3').hide();
			$('#content_menu_expand1').hide();
			$('#content_menu_expand5').hide();
			$('#content_menu_expand6').hide();
			$('#content_menu_expand7').hide();
			$('#content_menu_expand8').hide();
			$('#content_menu_expand9').hide();
			$('#content_menu_expand10').hide();
		}
		else
			$('#content_menu_expand4').hide();
		return false;
	});

	//method2
	$("#method2").autocomplete("operations/rpc_contract_method2.php", {
		selectFirst: true
	});
	$('#content_menu_expand5').hide();
	$(document).click(function() {
			$("#content_menu_expand5").hide();
	});
	$('#content_menu_expand5').click(function(e) {
		e.stopPropagation();
	});
	$('#menu_expand5').click(function(event) {
		if ($('#content_menu_expand5').is(":hidden")) {
			$('#content_menu_expand5').show();
			$('#content_menu_expand2').hide();
			$('#content_menu_expand3').hide();
			$('#content_menu_expand4').hide();
			$('#content_menu_expand1').hide();
			$('#content_menu_expand6').hide();
			$('#content_menu_expand7').hide();
			$('#content_menu_expand8').hide();
			$('#content_menu_expand9').hide();
			$('#content_menu_expand10').hide();
		}
		else
			$('#content_menu_expand5').hide();
		return false;
	});
	//nameProduct
	$("#nameProduct").autocomplete("operations/rpc_contract_nameProduct.php", {
		selectFirst: true
	});
	$('#content_menu_expand6').hide();
	$(document).click(function() {
			$("#content_menu_expand6").hide();
	});
	$('#content_menu_expand6').click(function(e) {
		e.stopPropagation();
	});
	$('#menu_expand6').click(function(event) {
		if ($('#content_menu_expand6').is(":hidden")) {
			$('#content_menu_expand6').show();
			$('#content_menu_expand2').hide();
			$('#content_menu_expand3').hide();
			$('#content_menu_expand4').hide();
			$('#content_menu_expand5').hide();
			$('#content_menu_expand1').hide();
			$('#content_menu_expand7').hide();
			$('#content_menu_expand8').hide();
			$('#content_menu_expand9').hide();
			$('#content_menu_expand10').hide();
		}
		else
			$('#content_menu_expand6').hide();
		return false;
	});
	//promotions
	$("#promotions").autocomplete("operations/rpc_contract_promotions.php", {
		selectFirst: true
	});
	$('#content_menu_expand7').hide();
	$(document).click(function() {
			$("#content_menu_expand7").hide();
	});
	$('#content_menu_expand7').click(function(e) {
		e.stopPropagation();
	});
	$('#menu_expand7').click(function(event) {
		if ($('#content_menu_expand7').is(":hidden")) {
			$('#content_menu_expand7').show();
			$('#content_menu_expand2').hide();
			$('#content_menu_expand3').hide();
			$('#content_menu_expand4').hide();
			$('#content_menu_expand5').hide();
			$('#content_menu_expand6').hide();
			$('#content_menu_expand1').hide();
			$('#content_menu_expand8').hide();
			$('#content_menu_expand9').hide();
			$('#content_menu_expand10').hide();
		}
		else
			$('#content_menu_expand7').hide();
		return false;
	});
	//agenciesCheck
	$("#agenciesCheck").autocomplete("operations/rpc_contract_agenciesCheck.php", {
		selectFirst: true
	});
	$('#content_menu_expand8').hide();
	$(document).click(function() {
			$("#content_menu_expand8").hide();
	});
	$('#content_menu_expand8').click(function(e) {
		e.stopPropagation();
	});
	$('#menu_expand8').click(function(event) {
		if ($('#content_menu_expand8').is(":hidden")) {
			$('#content_menu_expand8').show();
			$('#content_menu_expand2').hide();
			$('#content_menu_expand3').hide();
			$('#content_menu_expand4').hide();
			$('#content_menu_expand5').hide();
			$('#content_menu_expand6').hide();
			$('#content_menu_expand7').hide();
			$('#content_menu_expand1').hide();
			$('#content_menu_expand9').hide();
			$('#content_menu_expand10').hide();
		}
		else
			$('#content_menu_expand8').hide();
		return false;
	});
	//methodsPayment
	$("#methodsPayment").autocomplete("operations/rpc_contract_methodsPayment.php", {
		selectFirst: true
	});
	$('#content_menu_expand9').hide();
	$(document).click(function() {
			$("#content_menu_expand9").hide();
	});
	$('#content_menu_expand9').click(function(e) {
		e.stopPropagation();
	});
	$('#menu_expand9').click(function(event) {
		if ($('#content_menu_expand9').is(":hidden")) {
			$('#content_menu_expand9').show();
			$('#content_menu_expand2').hide();
			$('#content_menu_expand3').hide();
			$('#content_menu_expand4').hide();
			$('#content_menu_expand5').hide();
			$('#content_menu_expand6').hide();
			$('#content_menu_expand7').hide();
			$('#content_menu_expand8').hide();
			$('#content_menu_expand1').hide();
			$('#content_menu_expand10').hide();
		}
		else
			$('#content_menu_expand9').hide();
		return false;
	});
	//classification
	$("#classification").autocomplete("operations/rpc_contract_classification.php", {
		selectFirst: true
	});
	$('#content_menu_expand10').hide();
	$(document).click(function() {
			$("#content_menu_expand10").hide();
	});
	$('#content_menu_expand10').click(function(e) {
		e.stopPropagation();
	});
	$('#menu_expand10').click(function(event) {
		if ($('#content_menu_expand10').is(":hidden")) {
			$('#content_menu_expand10').show();
			$('#content_menu_expand2').hide();
			$('#content_menu_expand3').hide();
			$('#content_menu_expand4').hide();
			$('#content_menu_expand5').hide();
			$('#content_menu_expand6').hide();
			$('#content_menu_expand7').hide();
			$('#content_menu_expand8').hide();
			$('#content_menu_expand9').hide();
			$('#content_menu_expand1').hide();
		}
		else
			$('#content_menu_expand10').hide();
		return false;
	});
}
function clickCustomer1(gt){
	document.getElementById("nameCompany").value=gt;
	$('#content_menu_expand1').hide();
}
function clickCustomer2(gt){
	document.getElementById("agencies").value=gt;
	$('#content_menu_expand2').hide();
}

function clickCustomer3(gt){
	document.getElementById("method1").value=gt;
	$('#content_menu_expand3').hide();
}

function clickCustomer4(gt){
	document.getElementById("content1").value=gt;
	$('#content_menu_expand4').hide();
}

function clickCustomer5(gt){
	document.getElementById("method2").value=gt;
	$('#content_menu_expand5').hide();
}
function clickCustomer6(gt){
	document.getElementById("nameProduct").value=gt;
	$('#content_menu_expand6').hide();
}
function clickCustomer7(gt){
	document.getElementById("promotions").value=gt;
	$('#content_menu_expand7').hide();
}
function clickCustomer8(gt){
	document.getElementById("agenciesCheck").value=gt;
	$('#content_menu_expand8').hide();
}
function clickCustomer9(gt){
	document.getElementById("methodsPayment").value=gt;
	$('#content_menu_expand9').hide();
}

function clickCustomer10(gt){
	document.getElementById("classification").value=gt;
	$('#content_menu_expand10').hide();
}
function clickCustomer(gt){
	document.getElementById("nameCompany").value=gt;
	$('#content_menu_expand').hide();
}
function getotherMoney(type){
	var totalValue=new Number((document.getElementById("totalValue").value).replace(/,/gi,""));
	var prepaidMoney=new Number((document.getElementById("prepaidMoney").value).replace(/,/gi,""));
	var otherMoney=new Number((document.getElementById("otherMoney").value).replace(/,/gi,""));
	if(type=="totalValue"){
		if(prepaidMoney!=""){
			document.getElementById("otherMoney").value=accounting.formatNumber(totalValue-prepaidMoney);
		}
	}
	if(type=="prepaidMoney"){
		if(totalValue!=""){
			document.getElementById("otherMoney").value=accounting.formatNumber(totalValue-prepaidMoney);
		}
	}
	if(type=="otherMoney"){
		if(totalValue!="" && prepaidMoney!=""){
			document.getElementById("prepaidMoney").value=accounting.formatNumber(totalValue-otherMoney);
		}
	}
}
function enterTable(e,value,co){
    var key = window.event ? e.keyCode : e.which;
    
    if (key == 13 || key == 8 || key == 46  || key == 37 || key == 39 || key == 45 || co == '0') {
		if(key==13){
			var i = 0;
			var j = 0;
			var listID = new Array();
			
			
		    listID = listID.concat(["type","name","signer","signDay","totalValue","prepaidMoney","otherMoney","statusPayment","expectedDay","completeDay",
		                		    "area","placeDelivery","nameCompany","agencies","provideGovernment","method1","content1","method2","provide","nameProduct","promotions",
		                		    "expireWarrantyDay","agenciesCheck","methodsPayment","methodsDelivery","classification","comment"]);	
			
			if(value == listID[listID.length-1]){	
				document.getElementById("comment").focus();
				return false;			
			}else{
				for (j = 0; j < listID.length; j++){	
					if (listID[j] == value) {	
						if (j == listID.length - 1) {
							return false;
						}
						document.getElementById(listID[j + 1]).focus();
						document.getElementById(listID[j + 1]).select();
						return false; 
					}
				}
			}
			
			return false;
		}else
			return true;	
    } else if ( key < 48 || key > 57 ) {
        return false;
    }
    else return true;
				
}
</script>

<style type="text/css">
.content_menu_expand{
	position:absolute; 
	right:-5px;
	top:20px;
	z-index:999;
	background-color: #ffffff;
	-moz-border-radius: 7px;
	-webkit-border-radius: 7px;
	color: #000000;
	width:190px;
	max-height:180px;
	overflow:auto;
}

.passul{padding-left:0; border:1px solid black}
.bgkhac {background: #eee;}
.passul ul{padding:0px}
.passul ul li {color:#474747; font-size:12px;padding: 5px 0;padding-left:5px;list-style: none;text-decoration: none;}
.passul ul li:hover { background: #0A246A;color:white;text-decoration: none;list-style: none;}
</style>
<div class="content_code">
	<div class="title" style="padding-top: 5px;font-weight: bold;"><?php echo $l_accountant; ?>&rarr;<?php echo $l_contract; ?>&rarr;<?=$l_editcontract?></div>
	<div class="approval-right">
	<?php //if(isset($_SESSION['error'])){ echo $_SESSION['error'];unset($_SESSION['error']);}?>
	
	<form method="post" id="frmedit">	
	<input type="hidden" name="content" value="content_editcontract" />					
	<div style="border: 1px solid silver; border-radius: 7px 7px 7px 7px; padding-bottom: 10px; margin-bottom: 10px;" id="viewadd">
			<div style="margin: 10px 7px 5px 2px; color: #508E21; border-bottom: 1px dotted silver"> <?=$l_summary_contract?> </div>
								<table style="padding:2px 5px">
                                  <tr>
                                    <td class="tdfirst" style="width: 120px"><?=$l_type_contract?></td>
                                    <td style="width: 120px">
                                     	<select id="type" name="type" style="width:80px; height:28px;" onkeypress="return enterTable(event,this.id,'0')">
	                                        <?php 
	                                        	if(mysql_num_rows($mangContractType)>0){
	                                        		while($row= mysql_fetch_array($mangContractType)){
	                                        			if($type==$row['id']){
	                                        			?>
	                                        			<option value="<?=$row["id"];?>" selected="selected"><?php echo $row["name".$lang];?></option>
	                                        			<?php }else{?>
	                                        			<option value="<?=$row["id"];?>"><?php echo $row["name".$lang];?></option>
	                                        			<?php 
	                                        			}
	                                        		}
	                                        	}
	                                        ?>
	                                      </select>
                                    </td>
                                    <td class="tdfirst" style="width: 120px"><?=$l_code_contract?></td>
                                    <td><input type="text" id="code" name="code"  value="<?=$code?>"  style="width:200px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;" /><span style="color: red">(*)</span>
                                    	 <input type="hidden" name="id" id="id"  value="<?=$id?>" />
                                    </td>
                                  </tr>
                                </table>
								 <table style=" padding:2px 5px">
                                  <tr>
                                    <td class="tdfirst" style="width: 120px"><?=$l_name_contract?></td>
                                    <td><input type="text" id="name" name="name" onkeypress="return enterTable(event,this.id,'0')" value="<?=$name?>" style="width:547px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;" /><span style="color: red">(*)</span></td>
                                  </tr>
                                </table>
                                <table style="padding:2px 5px">
                                  <tr>
                                    <td class="tdfirst" style="width: 120px"><?=$l_signer_contract?></td>
                                    <td style="width: 220px"><?php echo $bien;?></td>
                                    <td class="tdfirst" style="width: 120px"><?=$l_signDay_contract?></td>
                                    <td><input type="text" id="signDay" name="signDay"  onkeypress="return enterTable(event,this.id,'0')"  style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;" value="<?=$signDay?>" /></td>
                                  </tr>
                                </table>
                                <table style="padding:2px 5px">
                                  <tr>
                                    <td class="tdfirst" style="min-width: 120px;width: 120px;"><?=$l_totalValue_contract?></td>
                                    <td style="min-width:220px;"><input type="text"  id="totalValue" onkeypress="return enterTable(event,this.id,'0')" onkeyup="getotherMoney('totalValue');" value="<?=$totalValue?>" name="totalValue" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;text-align: right;" /><span style="color: red">(*)</span></td>
                                     <td class="tdfirst" style="min-width: 120px;width: 120px;"><?=$l_prepaidMoney_contract?></td>
                                    <td style="width:220px;"><input type="text" id="prepaidMoney" onkeypress="return enterTable(event,this.id,'0')" onkeyup="getotherMoney('prepaidMoney');"  value="<?=$prepaidMoney?>" name="prepaidMoney" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;text-align: right;" /></td>
                                    <td class="tdfirst" style="min-width: 120px;width: 120px;"><?=$l_otherMoney_contract?></td>
                                    <td style="width:220px;"><input type="text" id="otherMoney" onkeypress="return enterTable(event,this.id,'0')" onkeyup="getotherMoney('otherMoney');"  value="<?=$otherMoney?>" name="otherMoney" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;text-align: right;"  /></td>
                                  </tr>
                                </table>
                                
                                <table style="padding:2px 5px">
                                  <tr>
                                    <td class="tdfirst" style="width: 120px"><?=$l_statusPayment_contract?></td>
                                    <td>
                                    	<label><input type="radio" id="statusPayment" name="statusPayment"  onkeypress="return enterTable(event,this.id,'0')" value="0" <?php if($statusPayment==0) echo 'checked="checked"'; ?> /><?=$l_uncomplete?></label>
                                    	<label><input type="radio" id="statusPayment"  name="statusPayment" onkeypress="return enterTable(event,this.id,'0')"  value="1" <?php if($statusPayment==1) echo 'checked="checked"'; ?> /><?=$l_complete?></label>
                                    </td>
                                  </tr>
                                </table>
                                <span style="color: red;padding:2px 5px">
								<?php echo $l_errorMessage;?>
								</span>
								</div>
								
				<div style="border: 1px solid silver; border-radius: 7px 7px 7px 7px; padding-bottom: 10px; margin-bottom: 10px;" id="viewadd">
			
			
			<div style="margin: 10px 7px 5px 2px; color: #508E21; border-bottom: 1px dotted silver"> <?=$l_details_contract?> </div>
								<table style="padding:2px 5px">
                                  <tr>
                                    <td class="tdfirst" style="width: 120px"><?=$l_expectedDay_contract?></td>
                                    <td style="width:220px;"><input type="text" value="<?=$expectedDay?>" id="expectedDay" name="expectedDay"  onkeypress="return enterTable(event,this.id,'0')" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;" /></td>
                                    <td class="tdfirst" style="width: 120px"><?=$l_completeDay_contract?></td>
                                    <td style="width:220px;"><input type="text" value="<?=$completeDay?>" id="completeDay" name="completeDay" onkeypress="return enterTable(event,this.id,'0')" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;"  /></td>
                                  </tr>
                                </table>
                                <table style="padding:2px 5px">
                                  <tr>
                                    <td class="tdfirst" style="width: 120px"><?=$l_area_contract?></td>
                                    <td style="width:220px;"><input type="text" value="<?=$area?>" id="area" name="area" onkeypress="return enterTable(event,this.id,'0')" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;" /></td>
                                    <td class="tdfirst" style="width: 120px"><?=$l_placeDelivery_contract?></td>
                                    <td style="width:220px;"><input type="text" value="<?=$placeDelivery?>" id="placeDelivery" name="placeDelivery" onkeypress="return enterTable(event,this.id,'0')" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;"  /></td>
                                  </tr>
                                </table>
                                <table style="padding:2px 5px">
                                  <tr>
                                    <td class="tdfirst" style="min-width: 120px;width: 120px;"><?=$l_nameCompany_contract?></td>
                                    <td style="min-width:220px;">
										<div style="float:left">
											<input type="text" size="30" name="nameCompany" id="nameCompany" onkeypress="return enterTable(event,this.id,'0')" value="<?=$nameCompany?>"  style="width: 190px;height: 24px; border: 1px solid #c4c0c9;font-size: 12px;line-height: 24px;" autocomplete="off" />
											<div class="suggestionsBox" id="suggestions" style="display:none;">
												<img src="images/upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
												<div class="suggestionList" id="autoSuggestionsList">
													&nbsp;
												</div>
											</div> 						
											</div>
											<div style=" float:left; position:relative; margin-top: 5px; margin-left: -21px">
												<img alt="" src="images/arrow-down.png" id="menu_expand1" onkeypress="return enterTable(event,this.id,'0')" >
											    <div id="content_menu_expand1" class="passul content_menu_expand" style="display:none">
											        <ul>
											        <?php 
											        
											    		$sql="select name from contract_company";
														$result = mysql_query($sql);
														if($result)
														{
															$i=0;
															while($row=mysql_fetch_array($result))
															{
																?>
																<li onmouseover="this.style.cursor='pointer'"  onmouseout="this.style.cursor='default'" onclick="clickCustomer1('<?=$row['name']?>')" 
																	<?php 
																		if($i%2!=0){
																			?>
																			class="bgkhac"
																			<?php 
																		}
																	?>
																> <?php echo $row['name'];?></li>
																<?php 
																$i++;
															}
														}
											    	?>
											        </ul>
											    </div>
											</div>
                                    
                                    
                                    </td>
                                    <td class="tdfirst" style="min-width: 120px;width: 120px;"><?=$l_agencies_contract?></td>
                                    <td style="width:220px;">
                                    <!--<input type="text" id="agencies" name="agencies" onkeypress="return enterTable(event,this.id,'0')" value="<?=$agencies?>" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;"  />-->
                                    <div style="float:left">
											<input type="text" size="30" name="agencies" id="agencies" onkeypress="return enterTable(event,this.id,'0')" value="<?=$agencies?>"  style="width: 190px;height: 24px; border: 1px solid #c4c0c9;font-size: 12px;line-height: 24px;" autocomplete="off" />
											<div class="suggestionsBox" id="suggestions" style="display:none;">
												<img src="images/upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
												<div class="suggestionList" id="autoSuggestionsList">
													&nbsp;
												</div>
											</div> 						
											</div>
											<div style=" float:left; position:relative; margin-top: 5px; margin-left: -21px">
												<img alt="" src="images/arrow-down.png" id="menu_expand2" onkeypress="return enterTable(event,this.id,'0')" >
											    <div id="content_menu_expand2" class="passul content_menu_expand" style="display:none">
											        <ul>
											        <?php 
											        
											    		$sql="select name from contract_agencies";
														$result = mysql_query($sql);
														if($result)
														{
															$i=0;
															while($row=mysql_fetch_array($result))
															{
																?>
																<li onmouseover="this.style.cursor='pointer'"  onmouseout="this.style.cursor='default'" onclick="clickCustomer2('<?=$row['name']?>')" 
																	<?php 
																		if($i%2!=0){
																			?>
																			class="bgkhac"
																			<?php 
																		}
																	?>
																> <?php echo $row['name'];?></li>
																<?php 
																$i++;
															}
														}
											    	?>
											        </ul>
											    </div>
											</div>
                                    </td>
                                    <td class="tdfirst" style="min-width: 120px;width: 120px;"><?=$l_provideGovernment_contract?></td>
                                    <td style="width:220px;"><input type="text" id="provideGovernment" name="provideGovernment" onkeypress="return enterTable(event,this.id,'0')" value="<?=$provideGovernment?>" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;"  /></td>
                                  </tr>
                                </table>
                                <table style="padding:2px 5px">
                                  <tr>
                                  	<td class="tdfirst" style="width: 120px"><?=$l_method_contract1?></td>
                                    <td style="width:220px;">
                                    <!-- <input type="text" id="method1" name="method1" onkeypress="return enterTable(event,this.id,'0')" value="<?=$method1?>" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;" />-->
                                   		 <div style="float:left">
											<input type="text" size="30" name="method1" id="method1" onkeypress="return enterTable(event,this.id,'0')" value="<?=$method1?>"  style="width: 190px;height: 24px; border: 1px solid #c4c0c9;font-size: 12px;line-height: 24px;" autocomplete="off" />
											<div class="suggestionsBox" id="suggestions" style="display:none;">
												<img src="images/upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
												<div class="suggestionList" id="autoSuggestionsList">
													&nbsp;
												</div>
											</div> 						
											</div>
											<div style=" float:left; position:relative; margin-top: 5px; margin-left: -21px">
												<img alt="" src="images/arrow-down.png" id="menu_expand3" onkeypress="return enterTable(event,this.id,'0')" >
											    <div id="content_menu_expand3" class="passul content_menu_expand" style="display:none">
											        <ul>
											        <?php 
											        
											    		$sql="select name from contract_method1";
														$result = mysql_query($sql);
														if($result)
														{
															$i=0;
															while($row=mysql_fetch_array($result))
															{
																?>
																<li onmouseover="this.style.cursor='pointer'"  onmouseout="this.style.cursor='default'" onclick="clickCustomer3('<?=$row['name']?>')" 
																	<?php 
																		if($i%2!=0){
																			?>
																			class="bgkhac"
																			<?php 
																		}
																	?>
																> <?php echo $row['name'];?></li>
																<?php 
																$i++;
															}
														}
											    	?>
											        </ul>
											    </div>
											</div>
                                    </td>
                                    <td class="tdfirst" style="width: 120px"><?=$l_content_contract?></td>
                                    <td style="width:220px;">
                                    	<!--  <input type="text" id="content1" name="content1" onkeypress="return enterTable(event,this.id,'0')" value="<?=$content1?>" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;" />-->
                                    	<div style="float:left">
											<input type="text" size="30" name="content1" id="content1" onkeypress="return enterTable(event,this.id,'0')" value="<?=$content1?>"  style="width: 190px;height: 24px; border: 1px solid #c4c0c9;font-size: 12px;line-height: 24px;" autocomplete="off" />
											<div class="suggestionsBox" id="suggestions" style="display:none;">
												<img src="images/upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
												<div class="suggestionList" id="autoSuggestionsList">
													&nbsp;
												</div>
											</div> 						
											</div>
											<div style=" float:left; position:relative; margin-top: 5px; margin-left: -21px">
												<img alt="" src="images/arrow-down.png" id="menu_expand4" onkeypress="return enterTable(event,this.id,'0')" >
											    <div id="content_menu_expand4" class="passul content_menu_expand" style="display:none">
											        <ul>
											        <?php 
											        
											    		$sql="select name from contract_content";
														$result = mysql_query($sql);
														if($result)
														{
															$i=0;
															while($row=mysql_fetch_array($result))
															{
																?>
																<li onmouseover="this.style.cursor='pointer'"  onmouseout="this.style.cursor='default'" onclick="clickCustomer4('<?=$row['name']?>')" 
																	<?php 
																		if($i%2!=0){
																			?>
																			class="bgkhac"
																			<?php 
																		}
																	?>
																> <?php echo $row['name'];?></li>
																<?php 
																$i++;
															}
														}
											    	?>
											        </ul>
											    </div>
											</div>
                                    </td>
                                  </tr>
                                </table>
                                
                                <table style="padding:2px 5px">
                                  <tr>
                                    <td class="tdfirst" style="width: 120px"><?=$l_method_contract2?></td>
                                    <td style="width:220px;">
                                    <!-- <input type="text" id="method2" name="method2" onkeypress="return enterTable(event,this.id,'0')" value="<?=$method2?>" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;" />-->
                                    <div style="float:left">
											<input type="text" size="30" name="method2" id="method2" onkeypress="return enterTable(event,this.id,'0')" value="<?=$method2?>"  style="width: 190px;height: 24px; border: 1px solid #c4c0c9;font-size: 12px;line-height: 24px;" autocomplete="off" />
											<div class="suggestionsBox" id="suggestions" style="display:none;">
												<img src="images/upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
												<div class="suggestionList" id="autoSuggestionsList">
													&nbsp;
												</div>
											</div> 						
											</div>
											<div style=" float:left; position:relative; margin-top: 5px; margin-left: -21px">
												<img alt="" src="images/arrow-down.png" id="menu_expand5" onkeypress="return enterTable(event,this.id,'0')" >
											    <div id="content_menu_expand5" class="passul content_menu_expand" style="display:none">
											        <ul>
											        <?php 
											        
											    		$sql="select name from contract_method2";
														$result = mysql_query($sql);
														if($result)
														{
															$i=0;
															while($row=mysql_fetch_array($result))
															{
																?>
																<li onmouseover="this.style.cursor='pointer'"  onmouseout="this.style.cursor='default'" onclick="clickCustomer5('<?=$row['name']?>')" 
																	<?php 
																		if($i%2!=0){
																			?>
																			class="bgkhac"
																			<?php 
																		}
																	?>
																> <?php echo $row['name'];?></li>
																<?php 
																$i++;
															}
														}
											    	?>
											        </ul>
											    </div>
											</div>
                                    </td>
                                    <td class="tdfirst" style="width: 120px"><?=$l_provide_contract?></td>
                                    <td style="width:220px;"><input type="text" id="provide" name="provide" onkeypress="return enterTable(event,this.id,'0')" value="<?=$provide?>" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;"  /></td>
                                  </tr>
                                </table>
                                <table style="padding:2px 5px">
                                  <tr>
                                    <td class="tdfirst" style="width: 120px"><?=$l_nameProduct_contract?></td>
                                    <td style="width:220px;">
                                    <!-- <input type="text" id="nameProduct" name="nameProduct" onkeypress="return enterTable(event,this.id,'0')" value="<?=$nameProduct?>" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;" />-->
                                    <div style="float:left">
											<input type="text" size="30" name="nameProduct" id="nameProduct" onkeypress="return enterTable(event,this.id,'0')" value="<?=$nameProduct?>"  style="width: 190px;height: 24px; border: 1px solid #c4c0c9;font-size: 12px;line-height: 24px;" autocomplete="off" />
											<div class="suggestionsBox" id="suggestions" style="display:none;">
												<img src="images/upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
												<div class="suggestionList" id="autoSuggestionsList">
													&nbsp;
												</div>
											</div> 						
											</div>
											<div style=" float:left; position:relative; margin-top: 5px; margin-left: -21px">
												<img alt="" src="images/arrow-down.png" id="menu_expand6" onkeypress="return enterTable(event,this.id,'0')" >
											    <div id="content_menu_expand6" class="passul content_menu_expand" style="display:none">
											        <ul>
											        <?php 
											        
											    		$sql="select name from contract_nameProduct";
														$result = mysql_query($sql);
														if($result)
														{
															$i=0;
															while($row=mysql_fetch_array($result))
															{
																?>
																<li onmouseover="this.style.cursor='pointer'"  onmouseout="this.style.cursor='default'" onclick="clickCustomer6('<?=$row['name']?>')" 
																	<?php 
																		if($i%2!=0){
																			?>
																			class="bgkhac"
																			<?php 
																		}
																	?>
																> <?php echo $row['name'];?></li>
																<?php 
																$i++;
															}
														}
											    	?>
											        </ul>
											    </div>
											</div>
                                    </td>
                                    <td class="tdfirst" style="width: 120px"><?=$l_promotions_contract?></td>
                                    <td style="width:220px;">
                                    <!-- <input type="text" id="promotions" name="promotions" onkeypress="return enterTable(event,this.id,'0')" value="<?=$promotions?>" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;"  />-->
                                    <div style="float:left">
											<input type="text" size="30" name="promotions" id="promotions" onkeypress="return enterTable(event,this.id,'0')" value="<?=$promotions?>"  style="width: 190px;height: 24px; border: 1px solid #c4c0c9;font-size: 12px;line-height: 24px;" autocomplete="off" />
											<div class="suggestionsBox" id="suggestions" style="display:none;">
												<img src="images/upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
												<div class="suggestionList" id="autoSuggestionsList">
													&nbsp;
												</div>
											</div> 						
											</div>
											<div style=" float:left; position:relative; margin-top: 5px; margin-left: -21px">
												<img alt="" src="images/arrow-down.png" id="menu_expand7" onkeypress="return enterTable(event,this.id,'0')" >
											    <div id="content_menu_expand7" class="passul content_menu_expand" style="display:none">
											        <ul>
											        <?php 
											        
											    		$sql="select name from contract_promotions";
														$result = mysql_query($sql);
														if($result)
														{
															$i=0;
															while($row=mysql_fetch_array($result))
															{
																?>
																<li onmouseover="this.style.cursor='pointer'"  onmouseout="this.style.cursor='default'" onclick="clickCustomer7('<?=$row['name']?>')" 
																	<?php 
																		if($i%2!=0){
																			?>
																			class="bgkhac"
																			<?php 
																		}
																	?>
																> <?php echo $row['name'];?></li>
																<?php 
																$i++;
															}
														}
											    	?>
											        </ul>
											    </div>
											</div>
                                    </td>
                                  </tr>
                                </table>
                                <table style="padding:2px 5px">
                                  <tr>
                                    <td class="tdfirst" style="width: 120px"><?=$l_expireWarrantyDay_contract?></td>
                                    <td style="width:220px;"><input type="text" id="expireWarrantyDay" name="expireWarrantyDay" onkeypress="return enterTable(event,this.id,'0')" value="<?=$expireWarrantyDay?>" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;" /></td>
                                    <td class="tdfirst" style="width: 120px"><?=$l_agenciesCheck_contract?></td>
                                    <td style="width:220px;">
                                    <!-- <input type="text" id="agenciesCheck" name="agenciesCheck" onkeypress="return enterTable(event,this.id,'0')" value="<?=$agenciesCheck?>" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;"  /> -->
                                    <div style="float:left">
											<input type="text" size="30" name="agenciesCheck" id="agenciesCheck" onkeypress="return enterTable(event,this.id,'0')" value="<?=$agenciesCheck?>"  style="width: 190px;height: 24px; border: 1px solid #c4c0c9;font-size: 12px;line-height: 24px;" autocomplete="off" />
											<div class="suggestionsBox" id="suggestions" style="display:none;">
												<img src="images/upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
												<div class="suggestionList" id="autoSuggestionsList">
													&nbsp;
												</div>
											</div> 						
											</div>
											<div style=" float:left; position:relative; margin-top: 5px; margin-left: -21px">
												<img alt="" src="images/arrow-down.png" id="menu_expand8" onkeypress="return enterTable(event,this.id,'0')" >
											    <div id="content_menu_expand8" class="passul content_menu_expand" style="display:none">
											        <ul>
											        <?php 
											        
											    		$sql="select name from contract_agenciesCheck";
														$result = mysql_query($sql);
														if($result)
														{
															$i=0;
															while($row=mysql_fetch_array($result))
															{
																?>
																<li onmouseover="this.style.cursor='pointer'"  onmouseout="this.style.cursor='default'" onclick="clickCustomer8('<?=$row['name']?>')" 
																	<?php 
																		if($i%2!=0){
																			?>
																			class="bgkhac"
																			<?php 
																		}
																	?>
																> <?php echo $row['name'];?></li>
																<?php 
																$i++;
															}
														}
											    	?>
											        </ul>
											    </div>
											</div>
                                    
                                    </td>
                                  </tr>
                                </table>
                                <table style="padding:2px 5px">
                                  <tr>
                                    <td class="tdfirst" style="width: 120px"><?=$l_methodsPayment_contract?></td>
                                    <td style="width:220px;">
                                    <!-- <input type="text" id="methodsPayment" name="methodsPayment" onkeypress="return enterTable(event,this.id,'0')" value="<?=$methodsPayment?>" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;" />-->
                                     <div style="float:left">
											<input type="text" size="30" name="methodsPayment" id="methodsPayment" onkeypress="return enterTable(event,this.id,'0')" value="<?=$methodsPayment?>"  style="width: 190px;height: 24px; border: 1px solid #c4c0c9;font-size: 12px;line-height: 24px;" autocomplete="off" />
											<div class="suggestionsBox" id="suggestions" style="display:none;">
												<img src="images/upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
												<div class="suggestionList" id="autoSuggestionsList">
													&nbsp;
												</div>
											</div> 						
											</div>
											<div style=" float:left; position:relative; margin-top: 5px; margin-left: -21px">
												<img alt="" src="images/arrow-down.png" id="menu_expand9" onkeypress="return enterTable(event,this.id,'0')" >
											    <div id="content_menu_expand9" class="passul content_menu_expand" style="display:none">
											        <ul>
											        <?php 
											        
											    		$sql="select name from contract_methodsPayment";
														$result = mysql_query($sql);
														if($result)
														{
															$i=0;
															while($row=mysql_fetch_array($result))
															{
																?>
																<li onmouseover="this.style.cursor='pointer'"  onmouseout="this.style.cursor='default'" onclick="clickCustomer9('<?=$row['name']?>')" 
																	<?php 
																		if($i%2!=0){
																			?>
																			class="bgkhac"
																			<?php 
																		}
																	?>
																> <?php echo $row['name'];?></li>
																<?php 
																$i++;
															}
														}
											    	?>
											        </ul>
											    </div>
											</div>
                                    </td>
                                    <td class="tdfirst" style="width: 120px"><?=$l_methodsDelivery_contract?></td>
                                    <td style="width:220px;"><input type="text" id="methodsDelivery" name="methodsDelivery" onkeypress="return enterTable(event,this.id,'0')" value="<?=$methodsDelivery?>" style="min-width: 400px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;"  /></td>
                                  </tr>
                                </table>
                                <table style="padding:2px 5px">
                                  <tr>
                                    <td class="tdfirst" style="min-width: 120px;width: 120px;"><?=$l_classification_contract?></td>
                                    <td style="min-width:220px;">
                                    <!-- <input type="text" id="classification" name="classification" onkeypress="return enterTable(event,this.id,'0')" value="<?=$classification?>" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;" />-->
                                    <div style="float:left">
											<input type="text" size="30" name="classification" id="classification" onkeypress="return enterTable(event,this.id,'0')" value="<?=$classification?>"  style="width: 190px;height: 24px; border: 1px solid #c4c0c9;font-size: 12px;line-height: 24px;" autocomplete="off" />
											<div class="suggestionsBox" id="suggestions" style="display:none;">
												<img src="images/upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
												<div class="suggestionList" id="autoSuggestionsList">
													&nbsp;
												</div>
											</div> 						
											</div>
											<div style=" float:left; position:relative; margin-top: 5px; margin-left: -21px">
												<img alt="" src="images/arrow-down.png" id="menu_expand10" onkeypress="return enterTable(event,this.id,'0')" >
											    <div id="content_menu_expand10" class="passul content_menu_expand" style="display:none">
											        <ul>
											        <?php 
											        
											    		$sql="select name from contract_classification";
														$result = mysql_query($sql);
														if($result)
														{
															$i=0;
															while($row=mysql_fetch_array($result))
															{
																?>
																<li onmouseover="this.style.cursor='pointer'"  onmouseout="this.style.cursor='default'" onclick="clickCustomer10('<?=$row['name']?>')" 
																	<?php 
																		if($i%2!=0){
																			?>
																			class="bgkhac"
																			<?php 
																		}
																	?>
																> <?php echo $row['name'];?></li>
																<?php 
																$i++;
															}
														}
											    	?>
											        </ul>
											    </div>
											</div>
                                    </td>
                                    <!--  <td class="tdfirst" style="min-width: 120px;width: 120px;"><?=$l_warranty_contract?></td>
                                    <td style="width:220px;"><input type="text" id="warranty" name="warranty" value="<?=$warranty?>" onkeypress="return enterTable(event,this.id,'0')" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;"  /></td>
                                    <td class="tdfirst" style="min-width: 120px;width: 120px;"><?=$l_warrantyDays_contract?></td>
                                    <td style="width:220px;"><input type="text" id="warrantyDays" name="warrantyDays" onkeypress="return enterTable(event,this.id,'0')" value="<?=$warrantyDays?>" style="min-width: 190px;border: 1px solid #ccc;font-size: 9pt;height: 24px;color: #555;line-height: 24px;"  /></td>-->
                                  </tr>
                                </table>
								<table style="padding:2px 5px">
                                  <tr>
                                    <td class="tdfirst" style="min-width: 120px;width: 120px;"><?=$l_comment?></td>
                                    <td style="min-width:220px;">
                                    	<textarea rows="3" cols="" style="width: 545px" id="comment" name="comment" ><?=$comment?></textarea>
                                    </td>
                                   
                                  </tr>
                                </table>
								</div>	
								<table style="padding-bottom:10px;padding-top:5px;margin:center;width:100%;">
									<tr>
                                    	<td>
                                        	<div style="width:100%;text-align:center;">
                                            	<input id="Update" name="Update" style="margin-right:3px" type="submit" value="<?php echo $l_update;?>" class="btnupbg btnupload" />
                                            	<input id="Delete" name="Delete" style="margin-right:3px" type="submit" value="<?php echo $l_delete;?>" onclick="if(confirm('<?php echo $l_areyousure;?>'))return true;else return false;" class="btnupbg btnupload" />
                                            	<input id="Cancel" name="Cancel" style="margin-right:3px" type="submit" value="<?php echo $l_cancel;?>" class="btnupbg btnupload" />
                                            </div>
                                        </td>

                                    </tr>
				</table>
								</form>
								</div>
							
							
						</div>
						
